<!-- 地块选择 -->
<template>
   <view class="setting-container" :style="{height: `${windowHeight}px`}">
    <view class="menu-list">
      <block v-if="langData.length">
        <view class="module" v-for="item in langData" :key="item.id" @click="handleSelect(item)">
          <view class="langName">{{ item.name }}</view>
          <view class="positionTop">
            <u-tag :text="item.fruitTreeTypeName" size="mini" type="success"></u-tag>
          </view>
            
        </view>
      </block>

      <block v-else>
        <u-empty mode="data" marginTop="120"></u-empty>
      </block>
    </view>
      
  </view>
    
</template>

<script>
import { getOrChardLangList } from '@/api/infoReporting';
export default {
  data() {
    return {
      windowHeight: uni.getSystemInfoSync().windowHeight,
      langData: [],
      aaaa: ''
    }
  },
  created() {
    this.$nextTick(async () => {
      const response = await getOrChardLangList();
      this.langData = response.data
    })
  },
  methods: {
    async handleSelect(landData) {
      //保存地块id
      await this.$store.dispatch('saveLandData', landData)
      this.$tab.reLaunch('/pages/work/index')
    },
  }
}
</script>

<style lang="scss">
  .module {
    height: 130rpx;
    line-height: 130rpx;
    padding-left: 14px;
    box-shadow: 5px 5px 5px #888888;
    background: #ffffff;
    border-radius: 18rpx;
    position: relative;
		margin-bottom: 12px;
    .positionTop {
      position: absolute;
      top: 10px;
      right: 12px;
    }
  }
  .langName {
    font-size: 36rpx;
    font-weight: 600;
    letter-spacing: 0.1em;
  }
</style>